package com.scs.application.modules.settlement.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.scs.application.core.model.CommonResult;
import com.scs.application.core.model.PageResult;
import com.scs.application.core.mvc.controller.CrudController;
import com.scs.application.core.mvc.controller.ImAndExAbleController;
import com.scs.application.modules.settlement.entity.StockPsi;
import com.scs.application.modules.settlement.request.StockPsiQueryRequest;
import com.scs.application.modules.settlement.service.StockPsiService;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 库存进销存数据 controller
 */
@AllArgsConstructor
@RestController
@RequestMapping("/stock_psis")
public class StockPsiController extends CrudController<StockPsi,String, StockPsiService> implements ImAndExAbleController<StockPsiQueryRequest> {


    @GetMapping("/page")
    public PageResult page(StockPsiQueryRequest request) {
        IPage page = service.page(request);
        return PageResult.ok("查询成功", page.getRecords(), page.getTotal());
    }

    @GetMapping("/list")
    public CommonResult list(StockPsiQueryRequest request) {
        List<StockPsi> list = service.list(request);
        return CommonResult.ok("查询成功", list);
    }


}
